package com.kefu.robot.vo;

import cn.hutool.core.util.IdUtil;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractInsertVo;
import com.kefu.robot.model.RobotAidataDoc;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;


/**
 * @author xiaoyu
 * @date 2023/11/03
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "AI模型词条")
public class RobotAidataDocInsertVo extends AbstractInsertVo<RobotAidataDoc> {

    @ApiModelProperty(value = "AI模型id", required = true)
    private String aidataId;
    @ApiModelProperty(value = "分类Id", required = true)
    private String docTypeId;
    @ApiModelProperty(value = "名称", required = true)
    private String name;
    @ApiModelProperty(value = "文件名称")
    private String fileName;
    @ApiModelProperty(value = "类型： 0：文本 1：文件", required = true)
    private Integer type;
    @ApiModelProperty(value = "内容")
    private String content;
    @ApiModelProperty(value = "文件url")
    private String url;

    @Override
    public RobotAidataDoc convert() {
        RobotAidataDoc info = BeanUtil.toBean(this, RobotAidataDoc.class);
        KefuContext context = KefuContext.getKefuContext();
        info.setDocId(IdUtil.getSnowflakeNextIdStr());
        info.setCreateTime(context.getNow());
        info.setCreateUser(context.getUserId());
        info.setUpdateTime(context.getNow());
        info.setUpdateUser(context.getUserId());
        info.setTenantId(context.getTenantId());
        return info;
    }
}